// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(document).ready(function() {

  $('#content').find('#error').hide().fadeIn(1500).animate({opacity: 1.0}, 3000).fadeOut(1500)
  $('#content').find('#notice').hide().fadeIn(1500).animate({opacity: 1.0}, 3000).fadeOut(1500)

  var max = 0;
  $("label").each(function(){
      if ($(this).width() > max)
          max = $(this).width();    
  });
  $("label").width(max);

  $('input#filter').change(function() {
    var identifier_string = $('#header_text > h3 > a').text();
    var rx = /(.*)\s\(/;
    var name = rx.exec(identifier_string)[1];
    if ($('input#filter').attr('checked')) {
      $('td.ec-event-cell:has(> div > a)').not(':contains('+ name + ')').fadeTo(500, 0);
    } else {
      $('td.ec-event-cell').fadeTo(500, 1);
    }
  });
});

